import request from "../utils/request.js";

export function userLogin(type, paramter) {
	return request({
		url: `/login/${type}`,
		method: 'post',
		data: paramter
	})
}

// 获取用户信息
export async function getUserInfo() {
	return await request({
		url: `/user`,
		method: 'get'
	})
}

// 获取用户优惠券
export function getUserCoupons(parameter) {
	return request({
		url: `/my-coupons`,
		method: 'get',
		data: parameter
	})
}

// 签到
export async function userSignIn() {
	return await request({
		url: `/sign-in`,
		method: 'post'
	})
}

// 获取用户晶石明细
export async function getScoreRecord(parameter) {
	return await request({
		url: '/asset-records/spar',
		method: 'get',
		data: parameter
	})
}

// 获取用户红包明细
export async function getRedpackRecord(parameter) {
	return await request({
		url: '/asset-records/redpack',
		method: 'get',
		data: parameter
	})
}
/*每日签到*/
// 获取用户签到情况
export async function getSignInCondit(targetId) {
	return await request({
		url: `/signIn/signInCondition/${targetId}`,
		method: 'get',
	})
}
// 用户签到奖励进度条
export async function getSignInProgress(targetId) {
	return await request({
		url: `/signIn/userSignInProgressBar/${targetId}`,
		method: 'get',
	})
}
// 连续签到奖励
export async function getSignInAward(targetId) {
	return await request({
		url: `/signIn/userSignInAwardList/${targetId}`,
		method: 'get',
	})
}
// 签到
export async function userRegister(parameter) {
	return await request({
		url: `/signIn/userSignIn`,
		method: 'post',
		data: parameter
	})
}
// 补签
export async function userReplace(parameter) {
	return await request({
		url: `/signIn/userReplaceSignIn`,
		method: 'post',
		data: parameter
	})
}
// 领取签到奖励
export async function userGetAward(parameter) {
	return await request({
		url: `/signIn/userGetAward`,
		method: 'post',
		data: parameter
	})
}
// 获取地址列表
export async function getAddresses(targetId) {
	return await request({
		url: `/signIn/addresses?targetId=${targetId}`,
		method: 'get',
	})
}